package com.chat.utils;

import com.chat.FileAddress;
import com.chat.view.FriendListData;
import com.chat.view.MainWindowView;
import com.chat.view.VerifyMessageView;
import javafx.application.Platform;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;


import java.io.File;

import static com.chat.view.MainWindowController.friend;

/*
 加载表情包的工具类
 */
public class Expression {
       public static ImageView getEmojis(int name){
           String url= FileAddress.EMOJI +name+".gif";
           ImageView imageView =new ImageView(new Image(url));
           imageView.setFitWidth(30);
           imageView.setFitHeight(30);
           imageView.setOnMouseClicked(event ->
                   Platform.runLater(new Runnable() {
                       @Override
                       public void run() {
                           String kk=((javafx.scene.control.TextArea) MainWindowView.$("inputbox")).getText();
                           ((javafx.scene.control.TextArea) MainWindowView.$("inputbox")).setText(kk+"["+name+"]");
                       }
                   })
           );
           return imageView;
       }

}
